#ifndef TOOLS_H
#define TOOLS_H

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

//error code
#define TOOLS_OK    0

#define TOOLS_PARAMETER_ERR    1

#define TOOLS_MD5_START_ERR         100
#define TOOLS_MD5_UPDATE_ERR        101
#define TOOLS_MD5_FINISH_ERR        102
#define TOOLS_MD5_FILE_OPEN_ERR     103
#define TOOLS_MD5_FILE_READ_ERR     104

#define TOOLS_SHA1_START_ERR         200
#define TOOLS_SHA1_UPDATE_ERR        201
#define TOOLS_SHA1_FINISH_ERR        202
#define TOOLS_SHA1_FILE_OPEN_ERR     203
#define TOOLS_SHA1_FILE_READ_ERR     204

#ifdef WIN32
#ifdef _TOOLSDK_
#define TOOL_API __declspec(dllexport)
#else
#define TOOL_API __declspec(dllimport)
#endif
#define STDCALL _stdcall
#else
#define TOOL_API
#define STDCALL
#endif

typedef void (*pfParsingProgress)(char *filepath, uint8_t dwProgress, void *pContent);

typedef struct _TFileParam
{
    char *filepath;
    char output[64];
    pfParsingProgress pFun;
    void *pContent;
}TFileParam;


TOOL_API int STDCALL Md5Computer( const uint8_t *input, int32_t ilen, char output[33]);
TOOL_API int STDCALL Md5FileComputer( TFileParam &tMd5FileParam );

TOOL_API int STDCALL Sha1Computer( const uint8_t *input, int32_t ilen, char output[41] );
TOOL_API int STDCALL Sha1FileComputer( TFileParam &tMd5FileParam );

#endif /* TOOLS_H */